﻿<phone:PhoneApplicationPage
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    xmlns:Converters="clr-namespace:MVBuddy.Converters;assembly=MVBuddy"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
	xmlns:cimbalinoBehaviors="clr-namespace:Cimbalino.Phone.Toolkit.Behaviors;assembly=Cimbalino.Phone.Toolkit"
    xmlns:MVBuddy_Common_Controls="clr-namespace:MVBuddy.Common.Controls;assembly=MVBuddy.Common"
    xmlns:bindableBar="clr-namespace:BindableApplicationBar;assembly=BindableApplicationBar"
    x:Class="MVBuddy.InfoPage"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="800"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="True">

	<phone:PhoneApplicationPage.DataContext>
		<Binding Mode="OneWay" Path="Main" Source="{StaticResource Locator}"/>
	</phone:PhoneApplicationPage.DataContext>
	
	<phone:PhoneApplicationPage.Resources>
		<Converters:IntToTextBoxStyleConverter x:Key="IntToTextBoxStyleConverter"/>
		<Converters:IntToDescriptionConverter x:Key="IntToDescriptionConverter"/>
	</phone:PhoneApplicationPage.Resources>
	
    <!--LayoutRoot is the root grid where all page content is placed-->
	<Grid x:Name="LayoutRoot" DataContext="{Binding Source={StaticResource Locator}}" Style="{StaticResource MVPageStyle}">
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="*"/>
		</Grid.RowDefinitions>

        <i:Interaction.Behaviors>
            <cimbalinoBehaviors:ApplicationBarBehavior>
                <cimbalinoBehaviors:ApplicationBarIconButton Text="{Binding Path=LocalizedResources.Refresh, Source={StaticResource LocalizedStrings}}" IconUri="/Assets/Appbar/appbar.refresh.rest.png" Click="Refresh_Click" />
                <cimbalinoBehaviors:ApplicationBarIconButton Text="{Binding Path=LocalizedResources.Settings, Source={StaticResource LocalizedStrings}}" IconUri="/Assets/Appbar/appbar.feature.settings.rest.png" Click="Settings_Click" />
                <cimbalinoBehaviors:ApplicationBarIconButton Text="{Binding Path=LocalizedResources.About, Source={StaticResource LocalizedStrings}}" IconUri="/Assets/Appbar/appbar.questionmark.rest.png" Click="About_Click" />
            </cimbalinoBehaviors:ApplicationBarBehavior>
        </i:Interaction.Behaviors>
        
        <MVBuddy_Common_Controls:PageHeaderControl d:LayoutOverrides="Height"/>
		<!--ContentPanel - place additional content here-->
		<Grid x:Name="ContentPanel" Grid.Row="1" Margin="0">
			<StackPanel x:Name="InfoStackPanel" Margin="24,12,0,0">
				<TextBlock Text="{Binding Main.Username}" Foreground="{StaticResource MVDarkGrayBrush}" FontSize="{StaticResource PhoneFontSizeExtraExtraLarge}" Margin="0,0,0,24" FontFamily="{StaticResource PhoneFontFamilyNormal}"/>
				<TextBlock x:Name="NotificationTextBlock" TextWrapping="Wrap" Tap="NotificationTextBlock_Tap" FontFamily="{StaticResource PhoneFontFamilyLight}" Margin="0,0,0,36" FontSize="{StaticResource PhoneFontSizeLarge}" Foreground="{Binding Main.NotificationData.NotificationCount, Converter={StaticResource IntToTextBoxStyleConverter}}">
					<i:Interaction.Behaviors>
						<cimbalinoBehaviors:MultiBindingBehavior Converter="{StaticResource IntToDescriptionConverter}" PropertyName="Text">
							<cimbalinoBehaviors:MultiBindingItem Value="{Binding Main.NotificationData.NotificationCount}" />
							<cimbalinoBehaviors:MultiBindingItem Value="{Binding Path=LocalizedResources.NotificationSingular, Source={StaticResource LocalizedStrings}}" />
						</cimbalinoBehaviors:MultiBindingBehavior>
					</i:Interaction.Behaviors>
				</TextBlock>
				<TextBlock x:Name="FavoriteTextBlock" TextWrapping="Wrap" Tap="FavoriteTextBlock_Tap" FontFamily="{StaticResource PhoneFontFamilyLight}" Margin="0,0,0,36" FontSize="{StaticResource PhoneFontSizeLarge}" Foreground="{Binding Main.NotificationData.FavoriteCount, Converter={StaticResource IntToTextBoxStyleConverter}}">
					<i:Interaction.Behaviors>
						<cimbalinoBehaviors:MultiBindingBehavior Converter="{StaticResource IntToDescriptionConverter}" PropertyName="Text">
							<cimbalinoBehaviors:MultiBindingItem Value="{Binding Main.NotificationData.FavoriteCount}" />
							<cimbalinoBehaviors:MultiBindingItem Value="{Binding Path=LocalizedResources.FavouriteSingular, Source={StaticResource LocalizedStrings}}" />
						</cimbalinoBehaviors:MultiBindingBehavior>
					</i:Interaction.Behaviors>
				</TextBlock>
				<TextBlock x:Name="MessageTextBlock" TextWrapping="Wrap" Tap="MessageTextBlock_Tap" FontFamily="{StaticResource PhoneFontFamilyLight}" Margin="0,0,0,36" FontSize="{StaticResource PhoneFontSizeLarge}" Foreground="{Binding Main.NotificationData.MessageCount, Converter={StaticResource IntToTextBoxStyleConverter}}">
					<i:Interaction.Behaviors>
						<cimbalinoBehaviors:MultiBindingBehavior Converter="{StaticResource IntToDescriptionConverter}" PropertyName="Text">
							<cimbalinoBehaviors:MultiBindingItem Value="{Binding Main.NotificationData.MessageCount}" />
							<cimbalinoBehaviors:MultiBindingItem Value="{Binding Path=LocalizedResources.MessageSingular, Source={StaticResource LocalizedStrings}}" />
						</cimbalinoBehaviors:MultiBindingBehavior>
					</i:Interaction.Behaviors>
				</TextBlock>
			</StackPanel>
			<StackPanel x:Name="LoadingStackPanel" VerticalAlignment="Center">
				<TextBlock TextWrapping="Wrap" Text="{Binding Path=LocalizedResources.InfoPage_LoadingData, Source={StaticResource LocalizedStrings}}" VerticalAlignment="Center" Foreground="{StaticResource MVDarkGrayBrush}" HorizontalAlignment="Center" FontFamily="{StaticResource PhoneFontFamilyNormal}"/>
				<ProgressBar Height="12" Background="{StaticResource MVDarkOrangeBrush}" Foreground="{StaticResource MVDarkOrangeBrush}" IsIndeterminate="True"/>
			</StackPanel>

		</Grid>
	</Grid>

</phone:PhoneApplicationPage>